package com.xzy.learn.spring.bean.destroy.bean;

import com.xzy.learn.spring.entity.Student;

import javax.annotation.PreDestroy;

/**
 * @author xzy.xiao
 * @date 2022/6/1  17:07
 */
public class StudentE extends Student {

    /**
     * 1.是否可以定义多个销毁方法？
     *   答：可以
     *
     * 2.多个销毁方法的执行顺序是怎样的？
     *   答：随机
     *      相关源码：{@link org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor#buildLifecycleMetadata}
     */

    @PreDestroy
    public void destroyByPreDestroyAnnotation1() {
        System.out.println("destroy bean by StudentE::destroyByPreDestroyAnnotation1()");
    }

    @PreDestroy
    public void destroyByPreDestroyAnnotation2() {
        System.out.println("destroy bean by StudentE::destroyByPreDestroyAnnotation2()");
    }

    @PreDestroy
    public void destroyByPreDestroyAnnotation3() {
        System.out.println("destroy bean by StudentE::destroyByPreDestroyAnnotation3()");
    }
}
